bakpakin on master
Add `tabseq` macro. (compare)
bakpakin on master
Add support for a dyn :task-id … (compare)
bakpakin on v1.23.0
bakpakin on master
Github showing old git attribut… (compare)
bakpakin on master
Prepare for 1.23.0 release. Remove ssize_t usage. (compare)
bakpakin on v1.23.0
bakpakin on v1.23.0
Prepare for 1.23.0 release. (compare)
bakpakin on master
Add support for 0-element array… Fix docstring. (compare)
bakpakin on master
Prepare for 1.23.0 release. (compare)
bakpakin on master
Update changelog to say FFI ini… Fix unset field in JanetFFIType. Fix trailing :pack-all or :pack… (compare)
where I have used X instead of an escaped double quote for clarity. This returns
[X]
[]
My question is: where does the second, empty, capture come from? I guess it won't matter, since adding an empty string won't affect my result, but I'd like to know, in case there is something I don't understand about what is going on.
@rrgmitchell: iiuc constant
already captures: https://github.com/sogaiu/margaret/blob/master/examples/constant.janet#L3-L5
i don't think capture
(aka <-
) is needed here, so this should work perhaps?
(peg/match ~(sequence "XX" (constant "X")) "XX")
# =>
@["X"]
fwiw, regarding csv handling, i think there have been some attempts.
here are some:
may be they are useful in some way for you.
each
(or loop
) loops, but in my case it's been walking a known ds. Maybe pre and postwalk are more useful generally. Ok, thanks.
(def mat1 [[1 2 3][4 5 6][7 8 9]])
# => ((1 2 3) (4 5 6) (7 8 9))
(postwalk inc mat1) # maybe increment each elem?
# Errors out (can't + a tuple)
(postwalk (fn [x] (if (number? x) (inc x) x))
[[1 2 3][4 5 6][7 8 9]])
# =>
((2 3 4) (5 6 7) (8 9 10))
not sure i follow.
is it possible drop
could be applied to your situation?
do you have some sample code?
@sogaiu:matrix.org
Here's the sample code:
(peg/match '{:dd (sequence :d :d)
:sep (set "/-")
:date (sequence :dd :sep :dd)
:wsep (some (set " \t"))
:entry (group (sequence (capture :date) :wsep (capture :date)))
:main (some (thru :entry))}
"1800-10-818-9-818 16/12 17/12 19/12 20/12 11/01 12/01"
)
#returns
@["00-10" "10-81" @["16/12" "17/12"] @["19/12" "20/12"] @["11/01" "12/01"]]
I would like to remove "00-10" and "10-81" from the output.
I had thought about drop, but I didn't know how to use it in this situation. :(
:main
with (some (choice :entry 1))
, I will push a fix and file a bug report
some
lets me continue "if i can't match... etc..." repeatedly until the end of input?
run-context
correctly when i want to execute some code that has access to my current environment/functions?
Why does this work:
(defn test-func []
(print "Hello there!"))
(defn test []
(def test-func-2 (eval-string "(fn [] (test-func))" ))
(test-func-2))
(test)
but this doesn't?:
(defn test-func []
(print "Hello there!"))
(defn test []
(def test-func-2 (eval-string "(fn [] (test-func))" ))
(test-func-2))
(defn main [& args]
(test))
(pp (curenv))
before (test)
in both cases