IRC channel logs


back to list of logs

<Apteryx>Hello! When using (ice-9 match), what is the canonical way to match a list of strings, and then mapping over it?
<Apteryx>I thought I could have something like: ((str1 str2 ...) (map my-proc (list uri1 uri2 ...)) but this doesn't seem valid.
<Apteryx>The use case is taking action on an argument that can be either 1) a single string or 2) a list of strings.
<daviid>Apteryx: why not immediately call map: (map myproc yourstrlist)
<Apteryx>because I don't always have a list; sometimes a lonely string comes, sometimes a list of strings.
<Apteryx>so the type differs
<daviid>Apteryx: (map myproc (match vals ((a) (list a)) ((a . rest) vals)))
<daviid>or the other way around if yu prefer
<daviid>(match vals ((a) (myproc a)) ((a . rest) (map myproc vals)))
<Apteryx>wouldn't (a) match '("some-string") rather than "some-string"?
<daviid>oh yes
<daviid>so use pair?
<daviid> (match vals ((a . rest) (map myproc vals)) (_ (myproc vals)))
<Apteryx>this seems to do it:
<daviid>the order is important ...
<Apteryx>I could use "..." after all, just not in the "then" clause
<Apteryx>thanks for eminding me I could reuse the top-bound value in (match top-value ...)
<Apteryx>When using (and condition1 condition2 condition3), can I use (delay ...) on condition3? It should only be eval'd if condition 1 and 2 are true (otherwise throws an exception).
<daviid>Apteryx and is a macro, it won't try to evaluate cond3 if any of the preceeding are #f
<Apteryx>interesting; that means my logic is broken, eh!
<Apteryx>sneek: later tell daviid, your match rules were required for my logic to work after all.
<sneek>Will do.
<Apteryx>how can I convert '() to #f? Is there no (bool '())?
<mwette>(not (null? '()))
<Apteryx>Strange... When I ran my script from Geiser, it's happy. When I run it from the terminal, it doesn't know about `string-match', even though I'm using the (ice-9 match) module.
<Apteryx>mwette: thanks!
<Apteryx>efraim: I got the gcc patch right I think! When you have the time, it is to go in core-updates.
<Apteryx>ACTION oops. wrong channel.
<dsmith-work>Wednesday Greetings, Guilers
<ArneBab>sneek: later tell mwette: ah yes (no terminator but newline). I need to add that for a general tutorial.
<ArneBab>sneek: botsnack
<dustyweb>I am in a room with Mark Miller of capabilities / erights!
<dustyweb>apparently he recently switched to working on WASM because of WASM-GC
<dustyweb>apparently WASM's GC stuff is core enough to have Mark Miller on it, and the reason he switched is capabilities based... having WASM have opaque unforgeable pointers means that capabilities are possible in WASM
<civodul>that's Rebooting the Web of Trust?
<dustyweb>civodul: yes
<dustyweb>civodul: Rebooting Web of Trust has been super cool
<cmaloney>I wish I understood any of those acronyms
<cmaloney>Web Assembly?
<dustyweb>WASM -> WebAssembly
<dustyweb>GC -> Garbage Collection
<dustyweb>so apparently WASM having GC means no manual memory management, which means that access is by scope
<dustyweb>which means! (and read Jonathan Rees' security kernel paper)
<dustyweb>security capabilities are possible
<cmaloney>Isn't WASM just javascript underneath?
<cmaloney>ACTION is a little late to this party
<dustyweb>no, it's a new set of VM operations
<dustyweb>not just VM either necessarily
<cmaloney>But it's using the JavaScript VM
<dustyweb>cmaloney: it may be compiled natively!
<cmaloney>*cough* MUG Presentation *cough*
<cmaloney>I want to get someone from Mozilla to talk about WASM and Rust
<dustyweb>would be cool... may be two separate speakers for that one :)
<cmaloney>Or someone who is a rather enthusiastic proponent of web tech
<cmaloney>since it's changed significantly even since 2016
<davexunit>so goops doesn't support method combination (a la CLOS), I guess?
<manumanumanu>ok... I have been reading about the nest macro. He claims that the "right fold" syntax-rules one is quadratic, but in my tests it is slower than the final version by a constant factor (and not by much. about 10%). Am I insane, or is it really quadratic?
<manumanumanu>it is the straight forward implementation by gwatt on IRC #scheme (search for gwatt on the page)
<manumanumanu>is it the matching that is quadratic? I only tested it up to six nests deep
<amz3`>AFAIK quadratic complexity or whatever doensn't always mean it is slower, it's only a clue...
<amz3`>say, 2² is 4 wheres 4*2 is 8...
<manumanumanu>amz3`: but then why whine that the algorithm was quadratic? He probably spent more time writing the syntax-case macros than any expansion of the syntax-rules macro will ever take.
<m3tti>hi guile channel
<manumanumanu>m3tti: hello!
<roelj>What's the fastest way Guile can write bytes to a file? Currently, I'm using (display ...), but with that I seem to only get to 5 megabytes per second.
<daviid>heya! anyone is using IPFS, i'm curious
<sneek>daviid, you have 1 message.
<sneek>daviid, Apteryx says: your match rules were required for my logic to work after all.